package com.uucrazy.googledoc;

import java.io.IOException;

import com.uucrazy.R;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import api.wireless.gdata.client.AbstructParserFactory;
import api.wireless.gdata.client.ServiceDataClient;
import api.wireless.gdata.data.Feed;
import api.wireless.gdata.docs.client.DocsClient;
import api.wireless.gdata.docs.client.DocsGDataClient;
import api.wireless.gdata.docs.data.DocumentEntry;
import api.wireless.gdata.docs.parser.xml.XmlDocsGDataParserFactory;
import api.wireless.gdata.parser.ParseException;
import api.wireless.gdata.util.AuthenticationException;
import api.wireless.gdata.util.ServiceException;

public class DocView extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		DocsGDataClient dataclent = new DocsGDataClient("www.uucrazy.com",
				ServiceDataClient.DEFAULT_AUTH_PROTOCOL,
				ServiceDataClient.DEFAULT_HOST);
		DocsClient docsClient = new DocsClient(dataclent,new XmlDocsGDataParserFactory(new AbstructParserFactory()));
		try {
			docsClient.setUserCredentials("crazy24k@gmail.com", "t251021591");
			Feed<DocumentEntry> feed =docsClient.getFeedOf("all");
			for(DocumentEntry entry : feed.getEntries())
			{
				Log.d("xxxxxxx", "xxx"+entry.getTitle());
			} 
		
		} catch (AuthenticationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}